Skip to content

feat: cache withTrim wrapped functions using WeakMap#21

Open
SKYJAMES777 wants to merge 1 commit into
bogeeee:mainfrom
SKYJAMES777:feat/withtrim-cache
Open

feat: cache withTrim wrapped functions using WeakMap#21
SKYJAMES777 wants to merge 1 commit into
bogeeee:mainfrom
SKYJAMES777:feat/withtrim-cache

Conversation

@SKYJAMES777

Copy link
Copy Markdown

Improvement

Add a WeakMap-based cache to withTrim so that calling it on the same
callback function returns the same wrapped instance. This allows using
the result with addEventListener/removeEventListener pairs.

Addresses the TODO comment in the JSDoc.

Closes #8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Minor: Improve withTrim

1 participant